package com.haoke.buyaction.config;

import com.haoke.cache.redis.RedisCacheConfiguration;
import com.haoke.message.publisher.HaokeMessagePublisher;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author yue13
 */
@Configuration
public class BuyactionConfiguration extends RedisCacheConfiguration {

    @Bean
    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
        return super.redisTemplate(redisConnectionFactory);
    }

    @Bean
    public HaokeMessagePublisher haokeMessagePublisher(AmqpTemplate amqpTemplate) {
        HaokeMessagePublisher haokeMessagePublisher = new HaokeMessagePublisher();
        haokeMessagePublisher.setAmqpTemplate(amqpTemplate);
        return haokeMessagePublisher;
    }
}
